package com.synjones.beijing.controls
{
    import mx.validators.Validator;
    import mx.validators.ValidationResult;    

    public class NewOldPasswordValidator extends Validator
    {
        private var results:Array;
        public function NewOldPasswordValidator()
        {
            super();
        }
        public var newoldPasswordSameError:String = "The new password and old password are same";
        override protected function doValidation(value:Object):Array {
            var newPassword:String = value.newPassword;
            var oldPassword:String = value.oldPassword;
            
            results = [];
            results = super.doValidation(value);
            if (results.length > 0)
                return results;
                
            if (newPassword == oldPassword) {
                results.push(new ValidationResult(true,null ,"SAME",newoldPasswordSameError));
                return results;
            }
            return results;
        }
        
    }
}